<html>
<head><meta charset="utf-8"><title>Does parallel rustc work? · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html">Does parallel rustc work?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="217340190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217340190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217340190">(Nov 19 2020 at 22:33)</a>:</h4>
<p>Just to learn, I tried setting <code>parallel_compiler = true</code>, in <code>config.toml</code>. It doesn't seem to have any effect. I've verified that <code>--cfg parallel_compiler</code> is being passed to the compiler during stage0, and I've looked at the generated assembly. But when I run the compiler, it has the same performance profile as when running it without. That is, everything is single-threaded, except for native codegen.</p>
<p>Is there something else I need to do to turn this on?</p>



<a name="217347297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217347297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217347297">(Nov 20 2020 at 00:00)</a>:</h4>
<p>I think you need -Z threads=2 or something like that?</p>



<a name="217350941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217350941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217350941">(Nov 20 2020 at 01:01)</a>:</h4>
<p>Yes, I believe current default is 1.</p>



<a name="217350954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217350954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217350954">(Nov 20 2020 at 01:01)</a>:</h4>
<p>But I would not expect significant wins.</p>



<a name="217448550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217448550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217448550">(Nov 20 2020 at 19:33)</a>:</h4>
<p>Thanks. Right, I'm not expecting any immediate wins, but I do want to understand where the costs are. And hopefully improve them.</p>



<a name="217453913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217453913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217453913">(Nov 20 2020 at 20:19)</a>:</h4>
<p>if you're also interested in written accounts of development, tests, benchmarks, the (currently inactive) parallel-rustc working group has a dedicated stream with discussions, meeting notes (IIRC) and so on <a href="#narrow/stream/187679-t-compiler.2Fwg-parallel-rustc">https://rust-lang.zulipchat.com/#narrow/stream/187679-t-compiler.2Fwg-parallel-rustc</a></p>



<a name="217513214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217513214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217513214">(Nov 21 2020 at 18:41)</a>:</h4>
<p><span class="user-mention" data-user-id="274471">@Arlie Davis</span> I'm hoping that my recent change to improve the compiler's TLS model helps here. Last time I profiled parallel rustc performance, one of the biggest performance bottlenecks was calls to <code>__tls_get_addr</code>.</p>



<a name="217513289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217513289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217513289">(Nov 21 2020 at 18:43)</a>:</h4>
<p>Should we do a new perf run for parallel rustc?</p>



<a name="217514350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217514350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217514350">(Nov 21 2020 at 19:11)</a>:</h4>
<p>I would love to see that, yes.</p>



<a name="217514359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217514359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217514359">(Nov 21 2020 at 19:11)</a>:</h4>
<p>As I recall, the previous such perf run tweaked the default number of threads.</p>



<a name="217514400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217514400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217514400">(Nov 21 2020 at 19:12)</a>:</h4>
<p>To ensure that parallelism was on by default.</p>



<a name="217514930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217514930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217514930">(Nov 21 2020 at 19:23)</a>:</h4>
<p>I'll do some perf measurements on scalability on my machine. I have a lot of cores to work with.</p>



<a name="217514999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217514999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217514999">(Nov 21 2020 at 19:25)</a>:</h4>
<p><span class="user-mention" data-user-id="274471">@Arlie Davis</span> Thank you!</p>



<a name="217515208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/217515208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Arlie Davis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#217515208">(Nov 21 2020 at 19:30)</a>:</h4>
<p>I have an improvement to the string interner that should help with parallelism. I doubt it's a huge cost, but everything helps, right?</p>



<a name="218876649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Does%20parallel%20rustc%20work%3F/near/218876649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F.html#218876649">(Dec 04 2020 at 18:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/131828-t-compiler/topic/Does.20parallel.20rustc.20work.3F/near/217514350">said</a>:</p>
<blockquote>
<p>I would love to see that, yes.</p>
</blockquote>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> queued <a href="https://github.com/rust-lang/rust/issues/79706">#79706</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>